<template>
  <div class="box">
    <div class="box-left">
      <Tabs :tabs="tabsList" @tabClick="handleTabClick" />
      <div class="TaBCenter" v-if="tabIndex == 0">
        <div>
          <chartCad />
        </div>
      </div>
      <div class="TaBCenter" v-if="tabIndex == 1">
        <div>
          <masterData />
        </div>
      </div>
      <div class="TaBCenter" v-if="tabIndex == 2">
        <div>
          <referenceData />
        </div>
      </div>
    </div>
    <div class="box-right">
      <div class="box-right-zd" @click="previewPdf"></div>
      <div class="box-right-gj" @click="handleChartClick"></div>
    </div>
  </div>
  <Dialog :visible="visible" @close="visible = false">
    <div class="utilContext">
      <div class="dataAssets" :class="{ active: activeItemIndex === 1 }" @click="clickItem(1, 'http://192.168.0.4:30181/?userName=admin')">
        数据资产管理系统
      </div>
      <div class="secondContext">
        <div class="item" :class="{ active: activeItemIndex === 2 }" @click="clickItem(2, 'http://192.168.0.4:8045/home')">
          <div>
            <div>元数据管理系统</div>
            <div class="secondTitle">（标准数据）</div>
          </div>
        </div>
        <div class="item" :class="{ active: activeItemIndex === 3 }" @click="clickItem(3)">
          <div>
            <div>主数据管理系统</div>
            <div class="secondTitle">（参考数据）</div>
          </div>
        </div>
        <div class="item" :class="{ active: activeItemIndex === 4 }" @click="clickItem(4)">数据质量系统</div>
        <div class="item" :class="{ active: activeItemIndex === 5 }" @click="clickItem(5, 'http://192.168.0.4:8039/#/')">指标管理系统</div>
      </div>
      <div class="thirdContext">
        <div class="item" :class="{ active: activeItemIndex === 6 }" @click="clickItem(6, 'http://192.168.0.14:30180/?userName=admin#/workplace')">
          <div>
            <div>数据管理/填报系统</div>
            <div>（数据建模）</div>
          </div>
        </div>
        <div class="item triple" :class="{ active: activeItemIndex === 7 }" @click="clickItem(7, 'http://192.168.0.4:8096/taskManage')">
          <div>
            <div>大数据平台</div>
            <div>（采集、转换、加工、API）</div>
          </div>
        </div>
      </div>
      <div class="lastContext" :class="{ active: activeItemIndex === 8 }" @click="clickItem(8)">
        <div class="item allIn">数据安全（鉴权、加密、解密、脱敏）</div>
      </div>
    </div>
  </Dialog>
</template>

<script setup>
import { ref, inject } from "vue";
import Tabs from "@/components/tabs/index.vue";
import chartCad from "./chartCard.vue";
import masterData from "./masterData.vue";
import referenceData from "./referenceData.vue";
import Dialog from "./UtilDialog/index.vue";
const visible = ref(false);
const handleChartClick = () => {
  visible.value = true;
};
const tabsList = [
  { title: "数据标准", value: 1 },
  { title: "主数据", value: 2 },
  { title: "参考数据", value: 3 },
];
let tabIndex = ref(0);

const handleTabClick = (index) => {
  tabIndex.value = index;
};

const previewPdf = () => {
  console.log(1111);
  grandpaCallbackf?.(true);
};
const grandpaCallbackf = inject("grandpaCallbackf");

const activeItemIndex = ref(0);

const clickItem = (index, url) => {
  activeItemIndex.value = index;
  if (url) {
    window.open(url, "_blank");
  } else {
    console.warn("URL is not provided");
  }
};
</script>

<style scoped lang="scss">
.TaBCenter {
  box-sizing: border-box;
  width: 100%;
  height: 231px;
  margin-top: 10px;
}
.box {
  display: flex;
}
.box-left {
  width: 683px;
  padding-top: 40px;
  box-sizing: border-box;
  background-image: url("../../../static/BGscreenLeft/sjbz.png");
  // background-image: url("../../../static/BGscreenLeft/sjbz.png");
  background-size: 100% 100%;
  background-repeat: no-repeat;
}
.box-right {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: 340px;
}
.box-right-zd {
  width: 100%;
  height: 156px;
  background-image: url("../../../static/BGscreenLeft/zd.png");
  background-size: 100% 100%;
  background-repeat: no-repeat;
}
.box-right-gj {
  width: 100%;
  height: 156px;
  background-image: url("../../../static/BGscreenLeft/gj.png");
  background-size: 100% 100%;
  background-repeat: no-repeat;
}

.utilContext {
  margin: 32px;

  .dataAssets {
    width: 1630px;
    height: 112px;
    background-image: url("../components/UtilDialog/utilItemBg.png");
    background-size: 100% 100%;
    background-repeat: no-repeat;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: YouSheBiaoTiHei;
    font-weight: 400;
    font-size: 36px;
    line-height: 40px;
    letter-spacing: 0px;
    text-align: center;
    color: #e8f5ff;
    cursor: pointer;
  }

  .secondContext {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 12px;

    .secondTitle {
      font-family: YouSheBiaoTiHei;
      font-weight: 400;
      font-size: 24px;
      line-height: 24px;
      letter-spacing: 0px;
      text-align: center;
    }
  }

  .item {
    width: 392px;
    height: 112px;
    background-image: url("../components/UtilDialog/utilItemBg.png");
    background-size: 100% 100%;
    background-repeat: no-repeat;
    font-family: YouSheBiaoTiHei;
    font-weight: 400;
    font-size: 36px;
    line-height: 40px;
    letter-spacing: 0px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #e8f5ff;
    cursor: pointer;
  }

  .thirdContext {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 12px;

    .triple {
      width: 1200px;
      text-align: center;
    }
  }

  .lastContext {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 12px;

    .allIn {
      width: 100%;
    }
  }

  .active {
    filter: drop-shadow(0 0 0px blue);
  }
}
</style>
